//
// Created by ly-zhouxyi on 2024/3/4.
//

#ifndef FFMPEGPLAYER_FFMPEGCALLJAVA_H
#define FFMPEGPLAYER_FFMPEGCALLJAVA_H

#include "jni.h"
#include <linux/stddef.h>
#include "AndroidLog.h"


class FFmpegCallJava {

public:
    _JavaVM *javaVM = NULL;
    JNIEnv *jniEnv = NULL;
    jobject jobj;

    jmethodID methodId_prepare;
    jmethodID methodId_renderYUV;
    jmethodID methodId_timeInfo;
    jmethodID methodId_load;
    jmethodID methodId_playing;
public:

    FFmpegCallJava(_JavaVM *javaVM, JNIEnv *env, jobject *obj);

    void onPrepare();

    void onRenderYUV(int width, int height, uint8_t *fy, uint8_t *fu, uint8_t *fv);

    void onTimeInfo(int curr, int total);

    void onLoad(bool load);

    void onPlaying(bool isPlaying);

    ~FFmpegCallJava();
};


#endif //FFMPEGPLAYER_FFMPEGCALLJAVA_H
